package com.website.view.menu
{
	import com.greensock.TweenMax;
	import com.website.control.PathManager;
	import com.website.util.Constant;
	import com.website.util.StringUtil;
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	public class PaginatedMenu extends Sprite
	{
		
		private var initShell:Boolean;
		private var rArrowOn:Boolean;
		private var myXMLList:XMLList;
		private var btnsArray:Array;
		private var ellipseArray:Array;
		private var navMenu:NavMenu;
		public var menuType:String;
		public var currNavId:int;
		private var rArrow:Sprite;
		private var visBtnsArray:Array;
		private var lArrowOn:Boolean;
		private var navItem:NavItem;
		private var ellipse:NavItem;
		private var lArrow:Sprite;
		
		public function PaginatedMenu(nameStr:String, xmlList:XMLList)
		{
			menuType = "PaginatedMenu";
			visible = false;
			alpha = 0;
			myXMLList = xmlList;
			name = nameStr;
			currNavId = 0;
			initShell = false;
			btnsArray = new Array();
			buildCol(myXMLList);
			buildArrows();
//			myRoot.stage.addEventListener(Event.RESIZE, onResizer, false, 0, true);
			doResize();
			alpha = 1;
		}
		
		private function buildCol(xmlList:XMLList) : void
		{
			var _loc_2:* = undefined;
			var _loc_3:int = 0;
			var _loc_4:* = undefined;
			var _loc_5:int = 0;
			buildEllipse();
			_loc_2 = 1;
			_loc_3 = 0;
			if (name == "Video" || name == "Recent")
			{
				_loc_3 = 0;
				while (_loc_3 < xmlList.length())
				{
					
					if (_loc_3 % 6 == 0)
					{
						navItem = new NavItem(_loc_2, String(_loc_2), (_loc_2 - 1));
						navItem.name = "navItem" + _loc_2;
						addChild(navItem);
						btnsArray.push(navItem);
						navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
						navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
						navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
						_loc_2 = _loc_2 + 1;
					}
					_loc_3++;
				}
			}
			else if (name == "Icons")
			{
				_loc_3 = 0;
				while (_loc_3 < xmlList.length())
				{
					
					if (_loc_3 % 8 == 0)
					{
						navItem = new NavItem( _loc_2, String(_loc_2), (_loc_2 - 1));
						navItem.name = "navItem" + _loc_2;
						addChild(navItem);
						btnsArray.push(navItem);
						navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
						navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
						navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
						_loc_2 = _loc_2 + 1;
					}
					_loc_3++;
				}
			}
			else if (name == "Visual")
			{
				_loc_3 = 0;
				while (_loc_3 < xmlList.length())
				{
					
					if (_loc_3 % 24 == 0)
					{
						navItem = new NavItem( _loc_2, String(_loc_2), (_loc_2 - 1));
						navItem.name = "navItem" + _loc_2;
						addChild(navItem);
						btnsArray.push(navItem);
						navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
						navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
						navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
						_loc_2 = _loc_2 + 1;
					}
					_loc_3++;
				}
			}
			else if (name == "Partners")
			{
				_loc_3 = 0;
				while (_loc_3 < xmlList.length())
				{
					
					if (_loc_3 % 8 == 0)
					{
						navItem = new NavItem( _loc_2, String(_loc_2), (_loc_2 - 1));
						navItem.name = "navItem" + _loc_2;
						addChild(navItem);
						btnsArray.push(navItem);
						navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
						navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
						navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
						_loc_2 = _loc_2 + 1;
					}
					_loc_3++;
				}
			}
			else if (name == "Senior Staff" || name == "Associates")
			{
				_loc_3 = 0;
				while (_loc_3 < xmlList.length())
				{
					
					if (_loc_3 % 8 == 0)
					{
						navItem = new NavItem( _loc_2, String(_loc_2), (_loc_2 - 1));
						navItem.name = "navItem" + _loc_2;
						addChild(navItem);
						btnsArray.push(navItem);
						navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
						navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
						navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
						_loc_2 = _loc_2 + 1;
					}
					_loc_3++;
				}
			}
			else if (name == "New York" || name == "Los Angeles")
			{
				_loc_3 = 0;
				while (_loc_3 < xmlList.length())
				{
					
					if (_loc_3 % 4 == 0)
					{
						navItem = new NavItem( _loc_2, String(_loc_2), (_loc_2 - 1));
						navItem.name = "navItem" + _loc_2;
						addChild(navItem);
						btnsArray.push(navItem);
						navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
						navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
						navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
						_loc_2 = _loc_2 + 1;
					}
					_loc_3++;
				}
			}
			else if (name == "General Info")
			{
				navItem = new NavItem( _loc_2, "General Info", (_loc_2 - 1));
				navItem.name = "navItem" + _loc_2;
				addChild(navItem);
				btnsArray.push(navItem);
				navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
				navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
				navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
				_loc_2 = _loc_2 + 1;
			}
			else if (name == "News")
			{
				_loc_3 = 0;
				while (_loc_3 < xmlList.length())
				{
					
					if (_loc_3 % 6 == 0)
					{
						navItem = new NavItem( _loc_2, "News", (_loc_2 - 1));
						navItem.name = "navItem" + _loc_2;
						addChild(navItem);
						btnsArray.push(navItem);
						navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
						navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
						navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
						_loc_2 = _loc_2 + 1;
					}
					_loc_3++;
				}
			}
			else if (name == "Civic" || name == "Corporate" || name == "Institutional" || name == "Master Plans" || name == "Performance" || name == "Residential" || name == "Current" || name == "Unbuilt" || name == "Furniture" || name == "Flatware" || name == "Other")
			{
				_loc_3 = 0;
				while (_loc_3 < xmlList.length())
				{
					
					if (_loc_3 % 68 == 0)
					{
						navItem = new NavItem( _loc_2, String(_loc_2), (_loc_2 - 1));
						navItem.name = "navItem" + _loc_2;
						addChild(navItem);
						btnsArray.push(navItem);
						navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
						navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
						navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
						_loc_2 = _loc_2 + 1;
					}
					_loc_3++;
				}
			}
			else
			{
				_loc_2 = 1;
				_loc_4 = 1;
				navItem = new NavItem( _loc_2, String(_loc_2), (_loc_2 - 1));
				navItem.name = "navItem" + _loc_2;
				addChild(navItem);
				btnsArray.push(navItem);
				navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
				navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
				navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
				_loc_3 = 0;
				while (_loc_3 < xmlList.length())
				{
					
					if (xmlList[_loc_3].item.length() > 0)
					{
						_loc_2 = _loc_2 + 1;
						if (_loc_2 >= 70)
						{
							_loc_4 = _loc_4 + 1;
							navItem = new NavItem( _loc_4, String(_loc_4), (_loc_4 - 1));
							navItem.name = "navItem" + _loc_4;
							addChild(navItem);
							btnsArray.push(navItem);
							navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
							navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
							navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
						}
						_loc_5 = 0;
						while (_loc_5 < xmlList[_loc_3].item.length())
						{
							
							_loc_2 = _loc_2 + 1;
							if (_loc_2 >= 70)
							{
								_loc_2 = 1;
								_loc_4 = _loc_4 + 1;
								navItem = new NavItem( _loc_4, String(_loc_4), (_loc_4 - 1));
								navItem.name = "navItem" + _loc_4;
								addChild(navItem);
								btnsArray.push(navItem);
								navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
								navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
								navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
							}
							_loc_5++;
						}
						_loc_2 = _loc_2 + 1;
						if (xmlList.length() == 16)
						{
							trace(_loc_2);
						}
						if (_loc_2 >= 70)
						{
							_loc_2 = 1;
							_loc_4 = _loc_4 + 1;
							navItem = new NavItem( _loc_4, String(_loc_4), (_loc_4 - 1));
							navItem.name = "navItem" + _loc_4;
							addChild(navItem);
							btnsArray.push(navItem);
							navItem.addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
							navItem.addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
							navItem.addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
						}
					}
					_loc_3++;
				}
			}
			return;
		}
		
		private function buildEllipse() : void
		{
			var _loc_1:int = 0;
			ellipseArray = new Array();
			_loc_1 = 0;
			while (_loc_1 < 2)
			{
				
				ellipse = new NavItem( "...", "...", _loc_1);
				ellipse.name = "ellipse" + _loc_1;
				addChild(ellipse);
				ellipseArray.push(ellipse);
				_loc_1++;
			}
			return;
		}
		
		private function btnRollOver(event:MouseEvent) : void
		{
			if (event.currentTarget.idNum != currNavId)
			{
				TweenMax.to(event.currentTarget.field, Constant.fadeSpeed, {tint:Constant.overColor, overwrite:true});
			}
			else
			{
				TweenMax.to(event.currentTarget.field, Constant.fadeSpeed, {tint:Constant.hotColor, overwrite:true});
			}
			return;
		}
		
		private function btnRollOut(event:MouseEvent) : void
		{
			if (event.currentTarget.idNum != currNavId)
			{
				TweenMax.to(event.currentTarget.field, Constant.fadeSpeed, {tint:Constant.coldColor, overwrite:true});
			}
			return;
		}
		
		private function btnClick(event:MouseEvent) : void
		{
			currNavId = event.currentTarget.idNum;
			switchCols(event.currentTarget.idNum);
			updateAddress();
			return;
		}
		
		private function buildArrows() : void
		{
			lArrow = new Sprite();
			lArrow.graphics.beginFill(uint(Constant.hotColor), 0);
			lArrow.graphics.drawRect(-3, -7, 11, 25);
			lArrow.graphics.endFill();
			lArrow.graphics.beginFill(uint(Constant.coldColor), 100);
			lArrow.graphics.drawRect(0, 4, 1, 1);
			lArrow.graphics.drawRect(1, 3, 1, 3);
			lArrow.graphics.drawRect(2, 2, 1, 5);
			lArrow.graphics.drawRect(3, 1, 1, 7);
			lArrow.graphics.drawRect(4, 0, 1, 9);
			lArrow.graphics.endFill();
			lArrow.buttonMode = true;
			lArrow.name = "lArrow";
			lArrow.addEventListener(MouseEvent.MOUSE_OVER, arrowRollOver);
			lArrow.addEventListener(MouseEvent.MOUSE_OUT, arrowRollOut);
			lArrow.addEventListener(MouseEvent.CLICK, arrowClick);
			rArrow = new Sprite();
			rArrow.graphics.beginFill(uint(Constant.hotColor), 0);
			rArrow.graphics.drawRect(-3, -7, 11, 25);
			rArrow.graphics.endFill();
			rArrow.graphics.beginFill(uint(Constant.coldColor), 100);
			rArrow.graphics.drawRect(0, 0, 1, 9);
			rArrow.graphics.drawRect(1, 1, 1, 7);
			rArrow.graphics.drawRect(2, 2, 1, 5);
			rArrow.graphics.drawRect(3, 3, 1, 3);
			rArrow.graphics.drawRect(4, 4, 1, 1);
			rArrow.graphics.endFill();
			rArrow.buttonMode = true;
			rArrow.name = "rArrow";
			rArrow.addEventListener(MouseEvent.MOUSE_OVER, arrowRollOver);
			rArrow.addEventListener(MouseEvent.MOUSE_OUT, arrowRollOut);
			rArrow.addEventListener(MouseEvent.CLICK, arrowClick);
			
			if (btnsArray.length > 1)
			{
				addChild(lArrow);
				addChild(rArrow);
			}
			return;
		}
		
		private function arrowRollOver(event:MouseEvent) : void
		{
			if (event.currentTarget.useHandCursor != false)
			{
				TweenMax.to(event.currentTarget, Constant.fadeSpeed, {tint:Constant.hotColor, overwrite:true});
			}
			return;
		}
		
		private function arrowRollOut(event:MouseEvent) : void
		{
			if (event.currentTarget.useHandCursor != false)
			{
				TweenMax.to(event.currentTarget, Constant.fadeSpeed, {tint:Constant.coldColor, overwrite:true});
			}
			return;
		}
		
		private function arrowClick(event:MouseEvent) : void
		{
			if (event.currentTarget.useHandCursor != false)
			{
				if (event.currentTarget.name == "rArrow")
				{
					currNavId = currNavId + 1;
					if (currNavId == btnsArray.length)
					{
						currNavId = btnsArray.length - 1;
					}
				}
				else
				{
					currNavId = currNavId - 1;
					if (currNavId < 0)
					{
						currNavId = 0;
					}
				}
				if (currNavId == (btnsArray.length - 1))
				{
					rArrow.useHandCursor = false;
				}
				else
				{
					rArrow.useHandCursor = true;
				}
				if (currNavId == 0)
				{
					lArrow.useHandCursor = false;
				}
				else
				{
					lArrow.useHandCursor = true;
				}
				switchCols(currNavId);
				updateAddress();
			}
			return;
		}
		
		public function fadeInShell() : void
		{
			if (initShell == false)
			{
				initShell = true;
				currNavId = 0;
			}
			switchCols(currNavId);
			updateAddress();
			if (btnsArray.length > 1)
			{
				visible = true;
			}
			else
			{
				visible = false;
			}
			TweenMax.to(this, Constant.fadeSpeed, {alpha:1, overwrite:true, delay:Constant.fadeSpeed});
			return;
		}
		
		private function switchCols(param1:Number) : void
		{
			updateNums();
			fadeBtns();
			return;
		}
		
		private function updateNums() : void
		{
			var _loc_1:* = undefined;
			var _loc_2:int = 0;
			_loc_1 = btnsArray.length - 1;
			_loc_2 = 0;
			while (_loc_2 < btnsArray.length)
			{
				
				if (btnsArray.length <= 5)
				{
					btnsArray[_loc_2].visible = true;
				}
				else if (_loc_2 == 0)
				{
					btnsArray[_loc_2].visible = true;
				}
				else if (_loc_2 == (btnsArray.length - 1))
				{
					btnsArray[_loc_2].visible = true;
				}
				else if (Math.abs(currNavId - _loc_2) == 1 || currNavId - _loc_2 == 0)
				{
					btnsArray[_loc_2].visible = true;
				}
				else
				{
					btnsArray[_loc_2].visible = false;
				}
				_loc_2++;
			}
			if (currNavId == 0 && btnsArray.length >= 3)
			{
				btnsArray[2].visible = true;
			}
			if (currNavId == (btnsArray.length - 1) && btnsArray.length >= 3)
			{
				btnsArray[btnsArray.length - 3].visible = true;
			}
			if (btnsArray.length <= 5)
			{
				ellipseArray[0].visible = false;
				ellipseArray[1].visible = false;
			}
			else if (currNavId >= 3 && currNavId <= btnsArray.length - 4)
			{
				ellipseArray[0].visible = true;
				ellipseArray[1].visible = true;
			}
			else if (btnsArray.length == 4)
			{
				ellipseArray[0].visible = false;
				ellipseArray[1].visible = false;
			}
			else if (currNavId >= 4)
			{
				ellipseArray[0].visible = true;
				ellipseArray[1].visible = false;
			}
			else if (currNavId <= btnsArray.length - 4)
			{
				ellipseArray[0].visible = true;
				ellipseArray[1].visible = false;
			}
			else if (currNavId == 3 && btnsArray.length == 6)
			{
				ellipseArray[0].visible = true;
				ellipseArray[1].visible = false;
			}
			else
			{
				ellipseArray[0].visible = false;
				ellipseArray[1].visible = false;
			}
			if (currNavId == (btnsArray.length - 1))
			{
				rArrowOn = false;
				rArrow.useHandCursor = false;
				TweenMax.to(rArrow, Constant.fadeSpeed, {tint:12500670, overwrite:true});
			}
			else
			{
				if (rArrowOn == false)
				{
					TweenMax.to(rArrow, Constant.fadeSpeed, {tint:Constant.coldColor, overwrite:true});
				}
				rArrowOn = true;
				rArrow.useHandCursor = true;
			}
			if (currNavId == 0)
			{
				lArrowOn = false;
				lArrow.useHandCursor = false;
				TweenMax.to(lArrow, Constant.fadeSpeed, {tint:12500670, overwrite:true});
			}
			else
			{
				if (lArrowOn == false)
				{
					TweenMax.to(lArrow, Constant.fadeSpeed, {tint:Constant.coldColor, overwrite:true});
				}
				lArrow.useHandCursor = true;
				lArrowOn = true;
			}
//			doResize();
			return;
		}
		
		private function fadeBtns() : void
		{
			var _loc_1:int = 0;
			_loc_1 = 0;
			while (_loc_1 < btnsArray.length)
			{
				
				if (_loc_1 != currNavId)
				{
					TweenMax.to(btnsArray[_loc_1].field, Constant.fadeSpeed, {tint:Constant.coldColor, overwrite:true});
				}
				else
				{
					TweenMax.to(btnsArray[_loc_1].field, Constant.fadeSpeed, {tint:Constant.hotColor, overwrite:true});
				}
				_loc_1++;
			}
			return;
		}
		
		public function fadeOutShell() : void
		{
			TweenMax.to(this, Constant.fadeSpeed, {alpha:0, overwrite:true, onComplete:function ():void
			{
				visible = false;
				return;
			}
			});
			return;
		}
		
		
		private function doResize() : void
		{
			var _loc_1:int = 0;
			var _loc_2:int = 0;
			var _loc_3:int = 0;
			visBtnsArray = new Array();
			_loc_1 = 0;
			if (btnsArray != null && btnsArray.length > 0)
			{
				lArrow.x = Math.round(3);
				rArrow.x = Math.round(lArrow.x + 11);
				var _loc_4:* = Math.round(7 * Constant.unitW / 75);
				rArrow.y = Math.round(7 * Constant.unitW / 75);
				lArrow.y = _loc_4;
				_loc_2 = 0;
				while (_loc_2 < btnsArray.length)
				{
					
					if (btnsArray[_loc_2].visible == true)
					{
						visBtnsArray.push(btnsArray[_loc_2]);
						if (btnsArray[(_loc_2 + 1)] != undefined)
						{
							if (btnsArray[(_loc_2 + 1)].visible == false)
							{
								visBtnsArray.push(ellipseArray[_loc_1]);
								ellipseArray[_loc_1].bg.visible = false;
								ellipseArray[_loc_1].bg.useHandCursor = false;
								ellipseArray[_loc_1].bg.mouseEnabled = false;
								ellipseArray[_loc_1].bg.buttonMode = false;
								_loc_1++;
							}
						}
					}
					_loc_2++;
				}
				_loc_3 = 0;
				while (_loc_3 < visBtnsArray.length)
				{
					
					var scaleXNum:Number = Constant.unitW / 75;
					visBtnsArray[_loc_3].field.scaleY = Constant.unitW / 75;
					visBtnsArray[_loc_3].field.scaleX = scaleXNum;
					if (_loc_3 == 0)
					{
						visBtnsArray[_loc_3].x = Math.round(rArrow.x + 11);
					}
					else
					{
						visBtnsArray[_loc_3].x = visBtnsArray[(_loc_3 - 1)].x + visBtnsArray[(_loc_3 - 1)].field.width;
					}
					visBtnsArray[_loc_3].bg.width = visBtnsArray[_loc_3].field.width;
					visBtnsArray[_loc_3].bg.height = visBtnsArray[_loc_3].field.height + 3;
					_loc_3++;
				}
			}
			return;
		}
		
		private function updateAddress() : void
		{
			switch(PathManager.pathNames[1])
			{
				case "architecture":
				{
					if (PathManager.pathNames[3] == "current")
					{
						PathManager.clickPathNames = ["projects", "architecture", "date", "current", btnsArray[currNavId].myText];
					}
					else if (PathManager.pathNames[3] == "unbuilt")
					{
						PathManager.clickPathNames = ["projects", "architecture", "date", "unbuilt", btnsArray[currNavId].myText];
					}
					else if (PathManager.pathNames[2] == "location")
					{
						PathManager.clickPathNames = ["projects", "architecture", "location", PathManager.pathNames[3], PathManager.pathNames[4], btnsArray[currNavId].myText];
					}
					else if (PathManager.pathNames[2] == "visual")
					{
						PathManager.clickPathNames = ["projects", "architecture", "visual", btnsArray[currNavId].myText];
					}
					else if (PathManager.pathNames[2] == "type")
					{
						PathManager.clickPathNames = ["projects", "architecture", "type", StringUtil.toLowercase(name), btnsArray[currNavId].myText];
					}
					else if (PathManager.pathNames[2] == "icons")
					{
						PathManager.clickPathNames = ["projects", "architecture", "icons", btnsArray[currNavId].myText];
					}
					break;
				}
				case "products":
				{
					if (PathManager.pathNames[2] == "date")
					{
						PathManager.clickPathNames = ["projects" + "/" + "products" + "/" + "date" + "/" + btnsArray[currNavId].myText];
					}
					else if (PathManager.pathNames[2] == "visual")
					{
						PathManager.clickPathNames = ["projects", "products", "visual", btnsArray[currNavId].myText];
					}
					else
					{
						PathManager.clickPathNames = ["projects", "products", "type", StringUtil.toLowercase(name), btnsArray[currNavId].myText];
					}
					break;
				}
				case "exhibitions":
				{
					if (PathManager.pathNames[2] == "date")
					{
						PathManager.clickPathNames = ["projects", "exhibitions", "date", btnsArray[currNavId].myText];
					}
					else if (PathManager.pathNames[2] == "location")
					{
						PathManager.clickPathNames = ["projects", "exhibitions", "location", PathManager.pathNames[3], PathManager.pathNames[4], btnsArray[currNavId].myText];
					}
					else if (PathManager.pathNames[2] == "visual")
					{
						PathManager.clickPathNames = ["projects", "exhibitions", "visual", btnsArray[currNavId].myText];
					}
					break;
				}
				case "partners":
				{
					PathManager.clickPathNames = ["practice", "partners", btnsArray[currNavId].myText];
					break;
				}
				case "staff":
				{
					switch(PathManager.pathNames[2])
					{
						case "new-york":
						{
							switch(PathManager.pathNames[3])
							{
								case "senior-staff":
								{
									PathManager.clickPathNames = ["practice", "staff", "new-york", "senior-staff", btnsArray[currNavId].myText];
									break;
								}
								case "associates":
								{
									PathManager.clickPathNames = ["practice", "staff", "new-york", "associates", btnsArray[currNavId].myText];
									break;
								}
								default:
								{
									break;
								}
							}
							break;
						}
						case "los-angeles":
						{
							switch(PathManager.pathNames[3])
							{
								case "senior-staff":
								{
									PathManager.clickPathNames = ["practice", "staff", "los-angeles", "senior-staff", btnsArray[currNavId].myText];
									break;
								}
								case "associates":
								{
									PathManager.clickPathNames = ["practice", "staff", "los-angeles", "associates", btnsArray[currNavId].myText];
									break;
								}
								default:
								{
									break;
								}
							}
							break;
						}
						default:
						{
							break;
						}
					}
					break;
				}
				case "press":
				{
					if (PathManager.pathNames[2] == "video")
					{
						PathManager.clickPathNames = ["practice", "press", "video", btnsArray[currNavId].myText];
					}
					if (PathManager.pathNames[2] == "publications")
					{
						PathManager.clickPathNames = ["practice", "press", "publications", "recent", btnsArray[currNavId].myText];
					}
					if (PathManager.pathNames[2] == "releases")
					{
						PathManager.clickPathNames = ["practice", "press", "releases", "recent", btnsArray[currNavId].myText];
					}
					break;
				}
				case "books":
				{
					PathManager.clickPathNames = ["practice", "books", "recent", btnsArray[currNavId].myText];
					break;
				}
				case "partners":
				{
					PathManager.clickPathNames = ["practice", "partners", btnsArray[currNavId].myText];
					break;
				}
				case "general-info":
				{
					PathManager.clickPathNames = ["contact", "general-info"];
					break;
				}
				case "employment":
				{
					switch(PathManager.pathNames[2])
					{
						case "new-york":
						{
							PathManager.clickPathNames = ["contact", "employment", "new-york", btnsArray[currNavId].myText];
							break;
						}
						case "los-angeles":
						{
							PathManager.clickPathNames = ["contact", "employment", "los-angeles", btnsArray[currNavId].myText];
							break;
						}
						default:
						{
							break;
						}
					}
					break;
				}
				default:
				{
					break;
				}
			}
			trace(PathManager.clickPathNames);
			PathManager.updateAddress(PathManager.clickPathNames.join("/") + "/");
		}

	}
}